1 Setup

source("helper_functions.R")
library(cytokit)
library(ggedit)
library(kableExtra)
library(monocle)
library(patchwork)
library(readxl)
library(readr)
library(R.utils)
library(Seurat)
library(tidyverse)
library(viridis)
sample <- c("joint_cortex.seurat")
tables_directory <- "tables"
dir.create(tables_directory, showWarnings = FALSE)
monocle_objects_directory <- "monocle_objects"
dir.create(monocle_objects_directory, showWarnings = FALSE)

1.1 Load Seurat objects

input_directory <- "/mnt/KLEINMAN_SCRATCH/projects/sjessa/from_hydra/single_cell/2019-02_revision1/output/atlas-02"
load(file.path(input_directory, "joint_cortex.seurat.Rda"))
seurat <- joint_cortex

1.2 Convert Seurat object to Monocle object.

selected_clusters <- c(20, 2, 12, 23)
selected_clusters <- paste0("^", selected_clusters, "-")
selected_clusters <- grep(paste(selected_clusters,collapse="|"), levels(seurat@ident), value=TRUE)
# Change cluster name
seurat@meta.data$cluster <- seurat@meta.data$cluster_joint

monocle <- seurat_to_monocle(seurat, selected_clusters)
monocle <- orderCells(monocle, reverse=FALSE)
colours <- monocle@experimentData@other$colours

2 Monocle plots

2.1 Cell trajectories

p <- plot_cell_trajectory(monocle, color_by="cluster", show_branch_points=FALSE) + scale_color_manual(values=colours)
p <- p + theme(legend.title=element_blank())
show(p)

p <- p + facet_wrap(~cluster) + theme(legend.position = "none")
show(p)

plot_cell_trajectory(monocle, color_by="Pseudotime", show_branch_points = TRUE)

plot_cell_trajectory(monocle, color_by="State", show_branch_points=TRUE)

p <- plot_complex_cell_trajectory(monocle, color_by="cluster", show_branch_points=FALSE) + scale_color_manual(values=colours)
p <- p + theme(legend.title=element_blank())
show(p)

2.2 Differentially expressed genes across pseudotime

2.2.1 All genes

diff_test_res_all_genes <- differentialGeneTest(monocle,
      fullModelFormulaStr = "~sm.ns(Pseudotime)", cores=12)
sig_gene_names_all_genes <- row.names(subset(diff_test_res_all_genes, qval < 0.1))
plot_pseudotime_heatmap(monocle[sig_gene_names_all_genes,],
      cores = 12,
      num_clusters=1,
      show_rownames = FALSE)

diff_test_res_all_genes <- diff_test_res_all_genes %>% rownames_to_column("gene")
write.table(diff_test_res_all_genes, file.path(tables_directory, "4-forebrain_astro_ependymal_joint_cortex_cluster_20_2_12_23_diff_test_res_all_genes.txt"), sep="\t", quote=FALSE, row.names = FALSE)

2.2.2 Transcription factors

input_directory <- "/mnt/KLEINMAN_SCRATCH/projects/blancha/analyses/njabado/single_cell/annotation/animaltfdb3.0"
input_file <- "Mus_musculus_TF.txt"
transcription_factors <- read_tsv(file.path(input_directory, input_file), col_types = cols())

2.2.2.1 Pseudotime heatmaps of significant transcription factors

2.2.2.1.1 q value < 5*10^-5
significant_genes_q_value_5_10_minus_5 <- filter(diff_test_res_all_genes, qval < 5*10^-5) %>% .$gene 
cat("Number of significant genes: ", length(significant_genes_q_value_5_10_minus_5))
## Number of significant genes:  3853
significant_transcription_factors_q_value_5_10_minus_5 <- as.character(significant_genes_q_value_5_10_minus_5[significant_genes_q_value_5_10_minus_5 %in% transcription_factors$Symbol])
cat("Number of significant transcription factors:", length(significant_transcription_factors_q_value_5_10_minus_5))
## Number of significant transcription factors: 176
plot_genes_heatmap_output_q_value_5_10_minus_5 <- plot_pseudotime_heatmap(monocle[significant_transcription_factors_q_value_5_10_minus_5,], cluster_rows=TRUE, num_clusters=3, return_heatmap=TRUE, show_rownames = TRUE)

plot_genes_heatmap_output_q_value_5_10_minus_5 <- plot_pseudotime_heatmap(monocle[significant_transcription_factors_q_value_5_10_minus_5,], cluster_rows=TRUE, num_clusters=1, return_heatmap=TRUE, show_rownames = TRUE)

# The RMarkdown PDF has issues, hence this custom function to save the PDF file.
save_pheatmap_pdf(plot_genes_heatmap_output_q_value_5_10_minus_5[[2]], file.path("figures", "4-forebrain_astro_ependymal_joint_cortex_cluster_20_2_12_23", "diff_test_res_plots_transcription_factors_only_q_value_5_10_minus_5_heatmap_custom.pdf"), width=16, height=36)
## pdf 
##   2
heatmap_matrix_q_value_5_10_minus_5 <- plot_genes_heatmap_output_q_value_5_10_minus_5[[1]]
ph_res_q_value_5_10_minus_5 <- plot_genes_heatmap_output_q_value_5_10_minus_5[[2]]
pheatmap_ordering_q_value_5_10_minus_5 <- rownames(heatmap_matrix_q_value_5_10_minus_5[ph_res_q_value_5_10_minus_5$tree_row[["order"]],])

transcription_factors_table_q_value_5_10_minus_5 <- filter(diff_test_res_all_genes, gene %in% significant_transcription_factors_q_value_5_10_minus_5)
# Put genes from the transcription factor table in the same order
transcription_factors_table_q_value_5_10_minus_5 <- transcription_factors_table_q_value_5_10_minus_5 %>% arrange(match(gene, pheatmap_ordering_q_value_5_10_minus_5))

write.table(transcription_factors_table_q_value_5_10_minus_5, file.path(tables_directory, "4-forebrain_astro_ependymal_joint_cortex_cluster_20_2_12_23-significant_transcription_factors_diff_test_analysis_qval_5_10_minus_5.txt"), sep="\t", quote=FALSE, row.names=FALSE)

heatmap_matrix_q_value_5_10_minus_5 <- plot_genes_heatmap_output_q_value_5_10_minus_5[[1]]
heatmap_matrix_q_value_5_10_minus_5 <- as.data.frame(heatmap_matrix_q_value_5_10_minus_5) %>% rownames_to_column("gene")
heatmap_matrix_q_value_5_10_minus_5 <- heatmap_matrix_q_value_5_10_minus_5 %>% arrange(match(gene, pheatmap_ordering_q_value_5_10_minus_5))
heatmap_matrix_q_value_5_10_minus_5 %>% head(20) %>% kable() %>% kable_styling() %>% scroll_box(height="200px", width="600px")
gene 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
Nfix 0.7322132 0.7553515 0.7783987 0.8012368 0.8237476 0.8458119 0.8673103 0.8881231 0.9081298 0.9272098 0.9452423 0.9621059 0.9776793 0.9918409 1.004469 1.015443 1.024640 1.0319395 1.0372210 1.0403638 1.0412481 1.0397547 1.0357653 1.0291624 1.0198298 1.0076524 0.9925165 0.9743101 0.9529227 0.9282460 0.9001737 0.8686018 0.8334289 0.7945561 0.7518878 0.7053314 0.6547978 0.6002015 0.5414611 0.4784993 0.4112434 0.3396254 0.2636509 0.1837346 0.1004371 0.0143125 -0.0740920 -0.1642379 -0.2555952 -0.3476435 -0.4398724 -0.5317817 -0.6228816 -0.7126928 -0.8007462 -0.8865829 -0.9697536 -1.0498181 -1.1263446 -1.1989087 -1.2670927 -1.3304844 -1.3886753 -1.4412600 -1.4878339 -1.5279919 -1.5613260 -1.5874242 -1.6058672 -1.6162272 -1.6180645 -1.6109258 -1.5943459 -1.5681458 -1.5325936 -1.4879816 -1.4345901 -1.3726893 -1.3025414 -1.2244025 -1.1385248 -1.0451580 -0.9445513 -0.8369551 -0.7226222 -0.6018097 -0.4747803 -0.3418030 -0.2031554 -0.0591235 0.0899964 0.2438969 0.4022595 0.5647529 0.7310331 0.9007430 1.0735115 1.2489539 1.4266713 1.6062509
Dlx1 1.8000044 1.7705239 1.7411388 1.7117691 1.6823371 1.6527667 1.6229841 1.5929174 1.5624967 1.5316541 1.5003243 1.4684438 1.4359516 1.4027893 1.368901 1.334233 1.298734 1.2623585 1.2250600 1.1867974 1.1475325 1.1072304 1.0658597 1.0233929 0.9798061 0.9350795 0.8891972 0.8421477 0.7939237 0.7445224 0.6939455 0.6421993 0.5892946 0.5352475 0.4800782 0.4238123 0.3664799 0.3081161 0.2487609 0.1884587 0.1272589 0.0652155 0.0024214 -0.0608280 -0.1241828 -0.1873177 -0.2499330 -0.3117543 -0.3725318 -0.4320397 -0.4900756 -0.5464589 -0.6010295 -0.6536466 -0.7041869 -0.7525429 -0.7986214 -0.8423413 -0.8836323 -0.9224328 -0.9586879 -0.9923479 -1.0233666 -1.0516988 -1.0772992 -1.1001200 -1.1201094 -1.1372094 -1.1513538 -1.1624659 -1.1704568 -1.1752223 -1.1766420 -1.1746795 -1.1694344 -1.1610003 -1.1494529 -1.1348525 -1.1172460 -1.0966683 -1.0731446 -1.0466911 -1.0173172 -0.9850268 -0.9498193 -0.9116918 -0.8706398 -0.8266590 -0.7797468 -0.7299038 -0.6771350 -0.6214522 -0.5628749 -0.5014321 -0.4371647 -0.3701263 -0.3003857 -0.2280283 -0.1531580 -0.0758991
Insm1 1.8643682 1.8355346 1.8067934 1.7780040 1.7490302 1.7197411 1.6900102 1.6597164 1.6287440 1.5969824 1.5643274 1.5306805 1.4959498 1.4600504 1.422905 1.384442 1.344601 1.3033282 1.2605787 1.2163173 1.1705185 1.1231668 1.0742570 1.0237948 0.9717964 0.9182895 0.8633126 0.8069157 0.7491599 0.6901172 0.6298707 0.5685137 0.5061501 0.4428929 0.3788644 0.3141952 0.2490232 0.1834930 0.1177549 0.0519634 -0.0137232 -0.0791450 -0.1441014 -0.2081775 -0.2709335 -0.3319968 -0.3910596 -0.4478747 -0.5022506 -0.5540467 -0.6031673 -0.6495564 -0.6931917 -0.7340795 -0.7722497 -0.8077510 -0.8406461 -0.8710084 -0.8989181 -0.9244588 -0.9477153 -0.9687702 -0.9877027 -1.0045855 -1.0194838 -1.0324534 -1.0435387 -1.0527711 -1.0601677 -1.0657288 -1.0694356 -1.0712482 -1.0711029 -1.0689695 -1.0648829 -1.0588589 -1.0508894 -1.0409437 -1.0289698 -1.0148954 -0.9986286 -0.9800582 -0.9590542 -0.9354676 -0.9091311 -0.8798591 -0.8474479 -0.8116762 -0.7723056 -0.7290820 -0.6817364 -0.6299868 -0.5735408 -0.5120980 -0.4453540 -0.3730047 -0.2947517 -0.2103081 -0.1194066 -0.0218068
Lhx9 1.9369366 1.9005958 1.8645245 1.8286014 1.7927107 1.7567416 1.7205887 1.6841519 1.6473364 1.6100531 1.5722184 1.5337545 1.4945895 1.4546580 1.413901 1.372264 1.329704 1.2861800 1.2416610 1.1961226 1.1495481 1.1019286 1.0532629 1.0035579 0.9528286 0.9010979 0.8483970 0.7947648 0.7402484 0.6849025 0.6287895 0.5719788 0.5145470 0.4565770 0.3981582 0.3393852 0.2803579 0.2211806 0.1619613 0.1028111 0.0438437 -0.0148261 -0.0730528 -0.1305280 -0.1869214 -0.2419497 -0.2953752 -0.3470029 -0.3966775 -0.4442802 -0.4897253 -0.5329559 -0.5739414 -0.6126729 -0.6491607 -0.6834306 -0.7155211 -0.7454808 -0.7733655 -0.7992365 -0.8231582 -0.8451963 -0.8654162 -0.8838819 -0.9006542 -0.9157898 -0.9293403 -0.9413510 -0.9518603 -0.9608983 -0.9684860 -0.9746345 -0.9793444 -0.9826463 -0.9846213 -0.9853402 -0.9848604 -0.9832272 -0.9804761 -0.9766333 -0.9717173 -0.9657397 -0.9587066 -0.9506187 -0.9414726 -0.9312616 -0.9199759 -0.9076040 -0.8941331 -0.8795499 -0.8638414 -0.8469960 -0.8290040 -0.8098592 -0.7895591 -0.7681067 -0.7455114 -0.7217902 -0.6969688 -0.6710834
Dlx5 1.7527835 1.7262526 1.6998093 1.6733763 1.6468783 1.6202419 1.5933958 1.5662706 1.5387991 1.5109161 1.4825587 1.4536663 1.4241805 1.3940454 1.363208 1.331617 1.299226 1.2659882 1.2318630 1.1968113 1.1607976 1.1237900 1.0857600 1.0466828 1.0065373 0.9653067 0.9229777 0.8795417 0.8349939 0.7893342 0.7425666 0.6946998 0.6457470 0.5957259 0.5446590 0.4925731 0.4394998 0.3854752 0.3305398 0.2747386 0.2181209 0.1607401 0.1026822 0.0441997 -0.0144107 -0.0728739 -0.1309360 -0.1883650 -0.2449500 -0.3005008 -0.3548469 -0.4078369 -0.4593371 -0.5092307 -0.5574163 -0.6038067 -0.6483277 -0.6909162 -0.7315197 -0.7700943 -0.8066035 -0.8410169 -0.8733090 -0.9034578 -0.9314434 -0.9572471 -0.9808499 -1.0022312 -1.0213678 -1.0382325 -1.0527929 -1.0650098 -1.0748375 -1.0822938 -1.0874956 -1.0905553 -1.0915734 -1.0906396 -1.0878346 -1.0832315 -1.0768961 -1.0688891 -1.0592663 -1.0480796 -1.0353784 -1.0212097 -1.0056195 -0.9886532 -0.9703565 -0.9507761 -0.9299603 -0.9079596 -0.8848278 -0.8606222 -0.8354042 -0.8092402 -0.7822022 -0.7543680 -0.7258217 -0.6966549
Csde1 2.2817896 2.2117013 2.1419152 2.0724399 2.0032836 1.9344543 1.8659599 1.7978083 1.7300071 1.6625637 1.5954855 1.5287796 1.4624530 1.3965126 1.330965 1.265817 1.201075 1.1367448 1.0728330 1.0093454 0.9462879 0.8836661 0.8214855 0.7597516 0.6984695 0.6376445 0.5772814 0.5173851 0.4579603 0.3990115 0.3405433 0.2825598 0.2250652 0.1680637 0.1115591 0.0555552 0.0000557 -0.0549359 -0.1094162 -0.1633817 -0.2168294 -0.2697560 -0.3221454 -0.3739025 -0.4249052 -0.4750336 -0.5241698 -0.5721981 -0.6190046 -0.6644774 -0.7085062 -0.7509823 -0.7917986 -0.8308489 -0.8680285 -0.9032331 -0.9363595 -0.9673048 -0.9959661 -1.0222409 -1.0460260 -1.0672179 -1.0857121 -1.1014030 -1.1141836 -1.1239450 -1.1305763 -1.1339639 -1.1339914 -1.1305394 -1.1234845 -1.1126994 -1.0980541 -1.0795124 -1.0571850 -1.0311922 -1.0016518 -0.9686794 -0.9323894 -0.8928951 -0.8503089 -0.8047433 -0.7563106 -0.7051240 -0.6512973 -0.5949458 -0.5361861 -0.4751369 -0.4119188 -0.3466550 -0.2794712 -0.2104962 -0.1398615 -0.0677022 0.0058432 0.0806328 0.1565208 0.2333578 0.3109903 0.3892609
Ybx1 2.2541043 2.1892731 2.1245399 2.0599165 1.9954142 1.9310444 1.8668185 1.8027479 1.7388437 1.6751172 1.6115795 1.5482418 1.4851149 1.4222100 1.359538 1.297109 1.234935 1.1730258 1.1113922 1.0500449 0.9889941 0.9282504 0.8678239 0.8077250 0.7479637 0.6885501 0.6294941 0.5708056 0.5124944 0.4545701 0.3970423 0.3399205 0.2832141 0.2269324 0.1710846 0.1156797 0.0607268 0.0062347 -0.0477878 -0.1013319 -0.1543892 -0.2069511 -0.2589984 -0.3104478 -0.3611929 -0.4111284 -0.4601497 -0.5081532 -0.5550362 -0.6006969 -0.6450340 -0.6879474 -0.7293374 -0.7691050 -0.8071521 -0.8433806 -0.8776932 -0.9099928 -0.9401825 -0.9681657 -0.9938457 -1.0171256 -1.0379084 -1.0560965 -1.0715922 -1.0842966 -1.0941104 -1.1009331 -1.1046629 -1.1051971 -1.1024310 -1.0962585 -1.0865733 -1.0733552 -1.0567173 -1.0367823 -1.0136721 -0.9875077 -0.9584095 -0.9264974 -0.8918912 -0.8547108 -0.8150759 -0.7731070 -0.7289247 -0.6826505 -0.6344065 -0.5843158 -0.5325024 -0.4790912 -0.4242085 -0.3679816 -0.3105392 -0.2520111 -0.1925285 -0.1322239 -0.0712311 -0.0096854 0.0522770 0.1145181
Zfp326 2.1999240 2.1373143 2.0750584 2.0131481 1.9515749 1.8903308 1.8294079 1.7687982 1.7084943 1.6484887 1.5887740 1.5293431 1.4701890 1.4113050 1.352684 1.294320 1.236207 1.1783378 1.1207069 1.0633084 1.0061365 0.9491856 0.8924504 0.8359255 0.7796058 0.7234864 0.6675623 0.6118290 0.5562820 0.5009168 0.4457292 0.3907152 0.3358708 0.2811922 0.2266758 0.1723181 0.1181157 0.0640655 0.0101644 -0.0435906 -0.0972021 -0.1506729 -0.2039885 -0.2570351 -0.3096656 -0.3617372 -0.4131113 -0.4636533 -0.5132325 -0.5617224 -0.6089997 -0.6549447 -0.6994409 -0.7423748 -0.7836354 -0.8231144 -0.8607051 -0.8963029 -0.9298042 -0.9611067 -0.9901084 -1.0167075 -1.0408020 -1.0622889 -1.0810640 -1.0970214 -1.1100527 -1.1200467 -1.1268887 -1.1304596 -1.1306359 -1.1272884 -1.1202834 -1.1095805 -1.0952849 -1.0775096 -1.0563633 -1.0319507 -1.0043738 -0.9737320 -0.9401229 -0.9036431 -0.8643884 -0.8224547 -0.7779382 -0.7309363 -0.6815477 -0.6298730 -0.5760152 -0.5200802 -0.4621769 -0.4024179 -0.3409196 -0.2778028 -0.2131928 -0.1472196 -0.0800186 -0.0117302 0.0574996 0.1275189
Zfp367 2.8042133 2.6739274 2.5471048 2.4236881 2.3036189 2.1868376 2.0732839 1.9628966 1.8556140 1.7513739 1.6501138 1.5517710 1.4562824 1.3635852 1.273617 1.186314 1.101614 1.0194561 0.9397776 0.8625175 0.7876152 0.7150108 0.6446448 0.5764587 0.5103947 0.4463957 0.3844057 0.3243694 0.2662324 0.2099415 0.1554442 0.1026892 0.0516261 0.0022056 -0.0456207 -0.0918999 -0.1366783 -0.1800010 -0.2219120 -0.2624545 -0.3016703 -0.3396004 -0.3762766 -0.4116845 -0.4457980 -0.4785971 -0.5100671 -0.5401985 -0.5689859 -0.5964273 -0.6225242 -0.6472803 -0.6707012 -0.6927942 -0.7135671 -0.7330286 -0.7511869 -0.7680501 -0.7836251 -0.7979174 -0.8109309 -0.8226669 -0.8331245 -0.8422992 -0.8501830 -0.8567640 -0.8620255 -0.8659456 -0.8684967 -0.8696446 -0.8693481 -0.8675577 -0.8642159 -0.8592948 -0.8528183 -0.8448074 -0.8352765 -0.8242341 -0.8116830 -0.7976217 -0.7820444 -0.7649418 -0.7463016 -0.7261096 -0.7043495 -0.6810040 -0.6560553 -0.6294859 -0.6012790 -0.5714195 -0.5398943 -0.5066938 -0.4718121 -0.4352480 -0.3970061 -0.3570975 -0.3155410 -0.2723638 -0.2276027 -0.1813050
Dlx2 2.4816524 2.3908621 2.3014926 2.2135248 2.1269398 2.0417189 1.9578435 1.8752951 1.7940557 1.7141072 1.6354318 1.5580121 1.4818305 1.4068699 1.333113 1.260544 1.189145 1.1188998 1.0497928 0.9818076 0.9149284 0.8491396 0.7844255 0.7207711 0.6581611 0.5965807 0.5360151 0.4764498 0.4178705 0.3602629 0.3036131 0.2479073 0.1931317 0.1392731 0.0863180 0.0342533 -0.0169339 -0.0672564 -0.1167268 -0.1653575 -0.2131609 -0.2601490 -0.3063204 -0.3515959 -0.3958748 -0.4390650 -0.4810823 -0.5218504 -0.5612998 -0.5993679 -0.6359978 -0.6711379 -0.7047415 -0.7367661 -0.7671724 -0.7959243 -0.8229877 -0.8483301 -0.8719200 -0.8937261 -0.9137167 -0.9318589 -0.9481182 -0.9624576 -0.9748365 -0.9852107 -0.9935310 -0.9997424 -1.0037835 -1.0055852 -1.0050697 -1.0021496 -0.9967276 -0.9887612 -0.9782995 -0.9653906 -0.9500748 -0.9323850 -0.9123482 -0.8899863 -0.8653166 -0.8383532 -0.8091075 -0.7775893 -0.7438074 -0.7077704 -0.6694879 -0.6289709 -0.5862328 -0.5412906 -0.4941652 -0.4448829 -0.3934757 -0.3399828 -0.2844510 -0.2269359 -0.1675029 -0.1062278 -0.0431979 0.0214874
Hmgb1 2.5242832 2.4375062 2.3509347 2.2646157 2.1785956 2.0929208 2.0076374 1.9227912 1.8384277 1.7545920 1.6713290 1.5886830 1.5066980 1.4254174 1.344884 1.265141 1.186230 1.1081925 1.0310690 0.9548998 0.8797245 0.8055820 0.7325104 0.6605471 0.5897288 0.5200916 0.4516707 0.3845003 0.3186143 0.2540455 0.1908258 0.1289868 0.0685587 0.0095715 -0.0479459 -0.1039652 -0.1584588 -0.2113999 -0.2627622 -0.3125201 -0.3606485 -0.4071229 -0.4519199 -0.4950209 -0.5364090 -0.5760675 -0.6139799 -0.6501300 -0.6845013 -0.7170775 -0.7478421 -0.7767785 -0.8038697 -0.8290986 -0.8524475 -0.8738983 -0.8934324 -0.9110305 -0.9266727 -0.9403381 -0.9520053 -0.9616515 -0.9692532 -0.9747859 -0.9782236 -0.9795394 -0.9787049 -0.9756905 -0.9704651 -0.9629961 -0.9532494 -0.9411894 -0.9267796 -0.9100252 -0.8909961 -0.8697671 -0.8464125 -0.8210061 -0.7936218 -0.7643335 -0.7332152 -0.7003413 -0.6657869 -0.6296275 -0.5919395 -0.5528002 -0.5122877 -0.4704814 -0.4274616 -0.3833099 -0.3381089 -0.2919428 -0.2448968 -0.1970574 -0.1485125 -0.0993511 -0.0496638 0.0004580 0.0509214 0.1016323
Smarce1 2.5789943 2.4838825 2.3895926 2.2961622 2.2036278 2.1120244 2.0213854 1.9317431 1.8431283 1.7555706 1.6690981 1.5837378 1.4995153 1.4164550 1.334580 1.253913 1.174474 1.0962827 1.0193587 0.9437191 0.8693807 0.7963593 0.7246695 0.6543253 0.5853398 0.5177252 0.4514930 0.3866541 0.3232185 0.2611958 0.2005949 0.1414241 0.0836915 0.0274045 -0.0274299 -0.0808049 -0.1327141 -0.1831512 -0.2321103 -0.2795855 -0.3255710 -0.3700613 -0.4130495 -0.4545232 -0.4944680 -0.5328693 -0.5697126 -0.6049833 -0.6386667 -0.6707477 -0.7012109 -0.7300407 -0.7572208 -0.7827345 -0.8065644 -0.8286923 -0.8490995 -0.8677660 -0.8846713 -0.8997935 -0.9131097 -0.9245958 -0.9342263 -0.9419743 -0.9478113 -0.9517073 -0.9536305 -0.9535472 -0.9514220 -0.9472169 -0.9408923 -0.9324059 -0.9217137 -0.9088131 -0.8937662 -0.8766393 -0.8574972 -0.8364041 -0.8134231 -0.7886170 -0.7620485 -0.7337799 -0.7038738 -0.6723933 -0.6394019 -0.6049637 -0.5691440 -0.5320088 -0.4936256 -0.4540631 -0.4133916 -0.3716830 -0.3290108 -0.2854505 -0.2410796 -0.1959776 -0.1502260 -0.1039086 -0.0571115 -0.0099231
Gabpb1 2.6514439 2.5421729 2.4350627 2.3301112 2.2273138 2.1266636 2.0281519 1.9317677 1.8374984 1.7453295 1.6552448 1.5672266 1.4812557 1.3973117 1.315373 1.235416 1.157417 1.0813507 1.0071920 0.9349138 0.8644889 0.7958893 0.7290864 0.6640514 0.6007549 0.5391673 0.4792587 0.4209990 0.3643582 0.3093059 0.2558120 0.2038464 0.1533790 0.1043799 0.0568194 0.0106682 -0.0341029 -0.0775227 -0.1196197 -0.1604220 -0.1999573 -0.2382526 -0.2753321 -0.3112037 -0.3458701 -0.3793354 -0.4116043 -0.4426823 -0.4725755 -0.5012903 -0.5288337 -0.5552126 -0.5804341 -0.6045052 -0.6274325 -0.6492227 -0.6698816 -0.6894147 -0.7078269 -0.7251220 -0.7413032 -0.7563726 -0.7703309 -0.7831779 -0.7949119 -0.8055296 -0.8150261 -0.8233948 -0.8306271 -0.8367124 -0.8416378 -0.8453882 -0.8479461 -0.8493181 -0.8495480 -0.8486803 -0.8467571 -0.8438180 -0.8399011 -0.8350426 -0.8292775 -0.8226399 -0.8151629 -0.8068790 -0.7978206 -0.7880197 -0.7775084 -0.7663192 -0.7544848 -0.7420388 -0.7290155 -0.7154499 -0.7013784 -0.6868386 -0.6718693 -0.6565109 -0.6408055 -0.6247968 -0.6085304 -0.5920536
Cbfb 2.6271505 2.5294749 2.4325852 2.3365352 2.2413772 2.1471617 2.0539374 1.9617513 1.8706487 1.7806732 1.6918666 1.6042694 1.5179201 1.4328559 1.349112 1.266723 1.185722 1.1061384 1.0280034 0.9513450 0.8761906 0.8025661 0.7304964 0.6600051 0.5911151 0.5238480 0.4582246 0.3942651 0.3319884 0.2714133 0.2125575 0.1554383 0.1000727 0.0464769 -0.0053329 -0.0553408 -0.1035312 -0.1498886 -0.1943974 -0.2370419 -0.2778063 -0.3166747 -0.3536387 -0.3887367 -0.4220233 -0.4535510 -0.4833710 -0.5115328 -0.5380845 -0.5630728 -0.5865430 -0.6085390 -0.6291037 -0.6482788 -0.6661048 -0.6826213 -0.6978669 -0.7118793 -0.7246951 -0.7363505 -0.7468807 -0.7563202 -0.7647028 -0.7720618 -0.7784298 -0.7838391 -0.7883212 -0.7919074 -0.7946284 -0.7965147 -0.7975964 -0.7979033 -0.7974648 -0.7963092 -0.7944628 -0.7919516 -0.7888015 -0.7850383 -0.7806875 -0.7757748 -0.7703255 -0.7643653 -0.7579193 -0.7510132 -0.7436722 -0.7359219 -0.7277878 -0.7192953 -0.7104702 -0.7013382 -0.6919250 -0.6822565 -0.6723589 -0.6622583 -0.6519809 -0.6415533 -0.6310019 -0.6203536 -0.6096352 -0.5988738
Olig2 2.7250149 2.6099930 2.4970088 2.3860935 2.2772741 2.1705736 2.0660115 1.9636037 1.8633623 1.7652965 1.6694120 1.5757116 1.4841952 1.3948601 1.307701 1.222710 1.139876 1.0591893 0.9806340 0.9041948 0.8298542 0.7575932 0.6873917 0.6192281 0.5530799 0.4889237 0.4267354 0.3664900 0.3081623 0.2517264 0.1971564 0.1444259 0.0935089 0.0443789 -0.0029900 -0.0486237 -0.0925476 -0.1347870 -0.1753663 -0.2143094 -0.2516398 -0.2873799 -0.3215548 -0.3542077 -0.3853869 -0.4151384 -0.4435060 -0.4705312 -0.4962535 -0.5207105 -0.5439377 -0.5659690 -0.5868362 -0.6065697 -0.6251981 -0.6427482 -0.6592457 -0.6747144 -0.6891769 -0.7026543 -0.7151664 -0.7267315 -0.7373670 -0.7470887 -0.7559114 -0.7638486 -0.7709129 -0.7771155 -0.7824667 -0.7869757 -0.7906505 -0.7934984 -0.7955256 -0.7967476 -0.7971942 -0.7968958 -0.7958820 -0.7941814 -0.7918223 -0.7888323 -0.7852387 -0.7810685 -0.7763482 -0.7711045 -0.7653636 -0.7591519 -0.7524959 -0.7454220 -0.7379568 -0.7301272 -0.7219602 -0.7134833 -0.7047241 -0.6957109 -0.6864722 -0.6770370 -0.6674347 -0.6576954 -0.6478497 -0.6379285
Hmgb3 2.7941326 2.6801905 2.5671995 2.4552525 2.3444403 2.2348508 2.1265690 2.0196770 1.9142539 1.8103754 1.7081140 1.6075385 1.5087146 1.4117040 1.316565 1.223353 1.132117 1.0429058 0.9557624 0.8707269 0.7878355 0.7071210 0.6286127 0.5523370 0.4783166 0.4065714 0.3371186 0.2699726 0.2051450 0.1426456 0.0824819 0.0246594 -0.0308177 -0.0839469 -0.1347265 -0.1831560 -0.2292351 -0.2729641 -0.3143434 -0.3533730 -0.3900524 -0.4243805 -0.4563670 -0.4860903 -0.5136508 -0.5391447 -0.5626642 -0.5842977 -0.6041298 -0.6222421 -0.6387129 -0.6536176 -0.6670291 -0.6790176 -0.6896513 -0.6989962 -0.7071165 -0.7140746 -0.7199316 -0.7247472 -0.7285797 -0.7314865 -0.7335242 -0.7347486 -0.7352147 -0.7349772 -0.7340902 -0.7326075 -0.7305828 -0.7280697 -0.7251215 -0.7217916 -0.7181335 -0.7141838 -0.7099543 -0.7054548 -0.7006949 -0.6956842 -0.6904325 -0.6849493 -0.6792445 -0.6733276 -0.6672085 -0.6608971 -0.6544030 -0.6477363 -0.6409068 -0.6339247 -0.6267998 -0.6195425 -0.6121628 -0.6046711 -0.5970777 -0.5893931 -0.5816277 -0.5737921 -0.5658971 -0.5579534 -0.5499719 -0.5419634
E2f2 2.9465733 2.7918114 2.6426217 2.4988414 2.3603095 2.2268671 2.0983572 1.9746255 1.8555202 1.7408919 1.6305944 1.5244843 1.4224210 1.3242675 1.229889 1.139156 1.051939 0.9681155 0.8875632 0.8101646 0.7358055 0.6643746 0.5957641 0.5298693 0.4665890 0.4058248 0.3474818 0.2914679 0.2376943 0.1860749 0.1365268 0.0889698 0.0433266 -0.0004774 -0.0425141 -0.0828528 -0.1215603 -0.1587008 -0.1943362 -0.2285261 -0.2613276 -0.2927959 -0.3229810 -0.3519151 -0.3796248 -0.4061374 -0.4314810 -0.4556838 -0.4787741 -0.5007803 -0.5217304 -0.5416523 -0.5605730 -0.5785192 -0.5955167 -0.6115904 -0.6267642 -0.6410610 -0.6545026 -0.6671093 -0.6789005 -0.6898938 -0.7001056 -0.7095506 -0.7182420 -0.7261913 -0.7334081 -0.7399002 -0.7456735 -0.7507319 -0.7550770 -0.7587081 -0.7616226 -0.7638312 -0.7653666 -0.7662604 -0.7665414 -0.7662362 -0.7653693 -0.7639633 -0.7620394 -0.7596177 -0.7567169 -0.7533552 -0.7495502 -0.7453188 -0.7406778 -0.7356442 -0.7302348 -0.7244668 -0.7183577 -0.7119258 -0.7051900 -0.6981701 -0.6908868 -0.6833620 -0.6756189 -0.6676818 -0.6595768 -0.6513311
Zfp143 2.8759247 2.7403159 2.6079452 2.4788143 2.3529193 2.2302512 2.1107962 1.9945359 1.8814477 1.7715054 1.6646792 1.5609362 1.4602408 1.3625547 1.267837 1.176047 1.087139 1.0010687 0.9177888 0.8372523 0.7594109 0.6842159 0.6116184 0.5415694 0.4740199 0.4089210 0.3462245 0.2858825 0.2278478 0.1720742 0.1185161 0.0671293 0.0178703 -0.0293026 -0.0744302 -0.1175518 -0.1587049 -0.1979257 -0.2352486 -0.2707062 -0.3043293 -0.3361469 -0.3661926 -0.3945366 -0.4212593 -0.4464365 -0.4701396 -0.4924362 -0.5133899 -0.5330611 -0.5515068 -0.5687812 -0.5849355 -0.6000187 -0.6140770 -0.6271546 -0.6392938 -0.6505347 -0.6609159 -0.6704742 -0.6792451 -0.6872625 -0.6945592 -0.7011669 -0.7071160 -0.7124362 -0.7171562 -0.7213038 -0.7249062 -0.7279901 -0.7305813 -0.7327053 -0.7343870 -0.7356480 -0.7365050 -0.7369741 -0.7370710 -0.7368113 -0.7362104 -0.7352835 -0.7340456 -0.7325117 -0.7306965 -0.7286150 -0.7262818 -0.7237117 -0.7209193 -0.7179193 -0.7147265 -0.7113557 -0.7078216 -0.7041393 -0.7003236 -0.6963898 -0.6923528 -0.6882281 -0.6840311 -0.6797772 -0.6754823 -0.6711620
Zfp207 2.2646530 2.1978389 2.1312801 2.0649991 1.9990179 1.9333583 1.8680415 1.8030888 1.7385209 1.6743582 1.6106208 1.5473286 1.4845011 1.4221574 1.360316 1.298997 1.238217 1.1779947 1.1183477 1.0592934 1.0008489 0.9430312 0.8858568 0.8293421 0.7735030 0.7183555 0.6639150 0.6101970 0.5572165 0.5049884 0.4535273 0.4028478 0.3529640 0.3038901 0.2556400 0.2082273 0.1616655 0.1159682 0.0711486 0.0272198 -0.0158053 -0.0579137 -0.0990936 -0.1393396 -0.1786485 -0.2170171 -0.2544422 -0.2909204 -0.3264484 -0.3610228 -0.3946400 -0.4272967 -0.4589890 -0.4897134 -0.5194661 -0.5482430 -0.5760403 -0.6028539 -0.6286795 -0.6535128 -0.6773493 -0.7001845 -0.7220135 -0.7428315 -0.7626335 -0.7814141 -0.7991681 -0.8158899 -0.8315737 -0.8462137 -0.8598035 -0.8723371 -0.8838080 -0.8942279 -0.9036356 -0.9120718 -0.9195771 -0.9261916 -0.9319552 -0.9369075 -0.9410879 -0.9445357 -0.9472900 -0.9493896 -0.9508734 -0.9517801 -0.9521482 -0.9520162 -0.9514226 -0.9504058 -0.9490042 -0.9472562 -0.9452000 -0.9428740 -0.9403166 -0.9375662 -0.9346611 -0.9316398 -0.9285406 -0.9254022
Zfp760 2.3256735 2.2488270 2.1727913 2.0975851 2.0232255 1.9497289 1.8771108 1.8053856 1.7345668 1.6646672 1.5956985 1.5276716 1.4605969 1.3944836 1.329340 1.265175 1.201995 1.1398074 1.0786172 1.0184302 0.9592511 0.9010842 0.8439331 0.7878011 0.7326910 0.6786050 0.6255450 0.5735126 0.5225090 0.4725349 0.4235910 0.3756776 0.3287946 0.2829419 0.2381191 0.1943256 0.1515607 0.1098237 0.0691136 0.0294294 -0.0092300 -0.0468654 -0.0834810 -0.1190975 -0.1537414 -0.1874383 -0.2202132 -0.2520902 -0.2830928 -0.3132437 -0.3425651 -0.3710785 -0.3988048 -0.4257642 -0.4519765 -0.4774609 -0.5022359 -0.5263199 -0.5497303 -0.5724845 -0.5945991 -0.6160904 -0.6369744 -0.6572665 -0.6769818 -0.6961350 -0.7147405 -0.7328123 -0.7503640 -0.7674090 -0.7839604 -0.8000308 -0.8156328 -0.8307814 -0.8454955 -0.8597938 -0.8736949 -0.8872170 -0.9003779 -0.9131952 -0.9256863 -0.9378682 -0.9497576 -0.9613711 -0.9727250 -0.9838353 -0.9947180 -1.0053886 -1.0158628 -1.0261557 -1.0362825 -1.0462581 -1.0560973 -1.0658147 -1.0754247 -1.0849417 -1.0943798 -1.1037529 -1.1130751 -1.1223599
write.table(heatmap_matrix_q_value_5_10_minus_5, file = file.path(tables_directory, "4-forebrain_astro_ependymal_joint_cortex_cluster_20_2_12_23-significant_transcription_factors_diff_test_analysis_qval_5_10_minus_5_heatmap_matrix.txt"), sep="\t", quote=FALSE, row.names=FALSE)
2.2.2.1.2 q value < 0.01
significant_genes_q_value_0.01 <- filter(diff_test_res_all_genes, qval < 0.01) %>% .$gene 
cat("Number of significant genes: ", length(significant_genes_q_value_0.01))
## Number of significant genes:  5880
significant_transcription_factors_q_value_0.01 <- as.character(significant_genes_q_value_0.01[significant_genes_q_value_0.01 %in% transcription_factors$Symbol])
cat("Number of significant transcription factors:", length(significant_transcription_factors_q_value_0.01))
## Number of significant transcription factors: 296
plot_genes_heatmap_output_q_value_0.01 <- plot_pseudotime_heatmap(monocle[significant_transcription_factors_q_value_0.01,], cluster_rows=TRUE, num_clusters=1, return_heatmap=TRUE, show_rownames = TRUE)

save_pheatmap_pdf(plot_genes_heatmap_output_q_value_0.01[[2]], file.path("figures", "4-forebrain_astro_ependymal_joint_cortex_cluster_20_2_12_23", "diff_test_plots_transcription_factors_only_q_value_0.01_heatmap_custom.pdf"), width=16, height=40)
## pdf 
##   2
heatmap_matrix_q_value_0.01 <- plot_genes_heatmap_output_q_value_0.01[[1]]
ph_res_q_value_0.01 <- plot_genes_heatmap_output_q_value_0.01[[2]]
pheatmap_ordering_q_value_0.01 <- rownames(heatmap_matrix_q_value_0.01[ph_res_q_value_0.01$tree_row[["order"]],])

transcription_factors_table_q_value_0.01 <- filter(diff_test_res_all_genes, gene %in% significant_transcription_factors_q_value_0.01)
# Put genes from the transcription factor table in the same order
transcription_factors_table_q_value_0.01 <- transcription_factors_table_q_value_0.01 %>% arrange(match(gene, pheatmap_ordering_q_value_0.01))

write.table(transcription_factors_table_q_value_0.01, file.path(tables_directory, "4-forebrain_astro_ependymal_joint_cortex_cluster_20_2_12_23-significant_transcription_factors_diff_test_analysis_qval_0.01.txt"), sep="\t", quote=FALSE, row.names=FALSE)

heatmap_matrix_q_value_0.01 <- plot_genes_heatmap_output_q_value_0.01[[1]]
heatmap_matrix_q_value_0.01 <- as.data.frame(heatmap_matrix_q_value_0.01) %>% rownames_to_column("gene")
heatmap_matrix_q_value_0.01 <- heatmap_matrix_q_value_0.01 %>% arrange(match(gene, pheatmap_ordering_q_value_0.01))
heatmap_matrix_q_value_0.01 %>% head(20) %>% kable() %>% kable_styling() %>% scroll_box(height="200px", width="600px")
gene 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
Zeb1 1.925268 1.856328 1.787851 1.7199079 1.6525667 1.5858939 1.5199545 1.4548119 1.3905279 1.3271627 1.2647751 1.2034223 1.1431601 1.0840432 1.0261247 0.9694565 0.9140893 0.8600728 0.8074556 0.7562851 0.7066081 0.6584705 0.6119174 0.5669933 0.5237421 0.4822073 0.4424320 0.4044593 0.3683317 0.3340920 0.3017831 0.2714479 0.2431298 0.2168725 0.1927205 0.1707188 0.1509134 0.1333511 0.1180800 0.1051494 0.0946100 0.0865143 0.0808811 0.0775220 0.0761737 0.0765744 0.0784635 0.0815809 0.0856667 0.0904611 0.0957038 0.1011339 0.1064902 0.1115105 0.1159323 0.1194925 0.1219280 0.1229756 0.1223725 0.1198572 0.1151690 0.1080497 0.0982437 0.0854986 0.0695666 0.0502048 0.0271766 0.0002525 -0.0307887 -0.0661587 -0.1060587 -0.1506778 -0.2001888 -0.2545838 -0.3135924 -0.3769195 -0.4442677 -0.5153392 -0.5898360 -0.6674618 -0.7479227 -0.8309280 -0.9161914 -1.0034318 -1.0923740 -1.1827493 -1.274296 -1.366762 -1.459902 -1.553479 -1.647268 -1.741051 -1.834622 -1.927783 -2.020348 -2.112141 -2.202996 -2.292757 -2.381280 -2.468428
Nfib 1.580629 1.546102 1.511625 1.4772113 1.4428718 1.4086190 1.3744648 1.3404211 1.3064998 1.2727127 1.2390714 1.2055878 1.1722735 1.1391400 1.1061989 1.0734617 1.0409398 1.0086445 0.9765871 0.9447790 0.9132314 0.8819553 0.8509619 0.8202623 0.7898674 0.7597883 0.7300358 0.7006207 0.6715540 0.6428464 0.6145085 0.5865512 0.5589850 0.5318205 0.5050684 0.4787391 0.4528432 0.4273911 0.4023932 0.3778600 0.3538019 0.3302291 0.3071418 0.2844795 0.2621597 0.2400998 0.2182180 0.1964324 0.1746616 0.1528243 0.1308396 0.1086270 0.0861061 0.0631968 0.0398195 0.0158949 -0.0086561 -0.0339120 -0.0599511 -0.0868511 -0.1146894 -0.1435427 -0.1734873 -0.2045988 -0.2369524 -0.2706225 -0.3056826 -0.3422058 -0.3802640 -0.4199285 -0.4612693 -0.5043558 -0.5492550 -0.5959767 -0.6444445 -0.6945750 -0.7462849 -0.7994910 -0.8541104 -0.9100604 -0.9672587 -1.0256234 -1.0850730 -1.1455264 -1.2069031 -1.2691233 -1.332108 -1.395777 -1.460055 -1.524863 -1.590124 -1.655764 -1.721707 -1.787881 -1.854210 -1.920625 -1.987053 -2.053424 -2.119669 -2.185721
Tead2 1.816708 1.759707 1.703103 1.6469411 1.5912653 1.5361191 1.4815444 1.4275821 1.3742720 1.3216528 1.2697622 1.2186370 1.1683128 1.1188244 1.0702056 1.0224895 0.9757083 0.9298932 0.8850750 0.8412836 0.7985483 0.7568978 0.7163601 0.6769629 0.6387335 0.6016985 0.5658844 0.5313174 0.4980233 0.4660280 0.4353570 0.4060361 0.3780908 0.3515469 0.3264302 0.3027669 0.2805833 0.2599062 0.2407628 0.2231809 0.2071887 0.1928152 0.1800648 0.1687911 0.1587940 0.1498752 0.1418380 0.1344869 0.1276275 0.1210662 0.1146103 0.1080677 0.1012473 0.0939585 0.0860117 0.0772182 0.0673909 0.0563438 0.0438930 0.0298567 0.0140556 -0.0036864 -0.0235419 -0.0456793 -0.0702625 -0.0974498 -0.1273936 -0.1602396 -0.1961258 -0.2351822 -0.2775296 -0.3232788 -0.3725281 -0.4252440 -0.4812046 -0.5401715 -0.6019070 -0.6661746 -0.7327401 -0.8013723 -0.8718437 -0.9439314 -1.0174174 -1.0920895 -1.1677415 -1.2441739 -1.321194 -1.398617 -1.476266 -1.553969 -1.631567 -1.708904 -1.785836 -1.862226 -1.937944 -2.012870 -2.086890 -2.159900 -2.231803 -2.302509
Hif1a 1.681940 1.635538 1.589295 1.5432478 1.4974292 1.4518730 1.4066126 1.3616811 1.3171110 1.2729346 1.2291839 1.1858904 1.1430854 1.1007998 1.0590642 1.0179090 0.9773641 0.9374593 0.8982241 0.8596877 0.8218790 0.7848269 0.7485598 0.7131060 0.6784936 0.6447508 0.6119052 0.5799845 0.5490163 0.5190280 0.4900471 0.4621008 0.4352165 0.4094213 0.3847425 0.3612074 0.3388433 0.3176776 0.2977378 0.2790514 0.2616463 0.2455502 0.2307701 0.2171866 0.2046346 0.1929497 0.1819683 0.1715270 0.1614634 0.1516153 0.1418208 0.1319189 0.1217484 0.1111491 0.0999611 0.0880248 0.0751815 0.0612731 0.0461423 0.0296329 0.0115894 -0.0081422 -0.0297146 -0.0532788 -0.0789842 -0.1069780 -0.1374052 -0.1704086 -0.2061278 -0.2446997 -0.2862576 -0.3309315 -0.3788453 -0.4300131 -0.4842857 -0.5414999 -0.6014928 -0.6641016 -0.7291643 -0.7965197 -0.8660077 -0.9374697 -1.0107485 -1.0856889 -1.1621374 -1.2399430 -1.318957 -1.399032 -1.480025 -1.561795 -1.644203 -1.727114 -1.810395 -1.893916 -1.977552 -2.061179 -2.144677 -2.227929 -2.310820 -2.393240
Olig1 1.597122 1.554088 1.511201 1.4684945 1.4260030 1.3837594 1.3417965 1.3001470 1.2588429 1.2179160 1.1773979 1.1373195 1.0977117 1.0586047 1.0200287 0.9820133 0.9445880 0.9077818 0.8716233 0.8361412 0.8013636 0.7673184 0.7340332 0.7015354 0.6698522 0.6390106 0.6090374 0.5799591 0.5518023 0.5245931 0.4983580 0.4731228 0.4489138 0.4257569 0.4036782 0.3827036 0.3628592 0.3441712 0.3266656 0.3103690 0.2953078 0.2815086 0.2689760 0.2575814 0.2471479 0.2374995 0.2284607 0.2198569 0.2115138 0.2032578 0.1949155 0.1863143 0.1772819 0.1676466 0.1572375 0.1458841 0.1334170 0.1196678 0.1044691 0.0876552 0.0690618 0.0485266 0.0258892 0.0009921 -0.0263198 -0.0561981 -0.0887910 -0.1242427 -0.1626929 -0.2042762 -0.2491220 -0.2973535 -0.3490852 -0.4043110 -0.4628471 -0.5244942 -0.5890522 -0.6563209 -0.7261004 -0.7981915 -0.8723962 -0.9485180 -1.0263622 -1.1057367 -1.1864519 -1.2683214 -1.351162 -1.434795 -1.519045 -1.603741 -1.688717 -1.773812 -1.858871 -1.943741 -2.028279 -2.112345 -2.195806 -2.278534 -2.360407 -2.441312
Foxg1 1.617490 1.557250 1.497304 1.4377294 1.3786018 1.3199960 1.2619855 1.2046429 1.1480397 1.0922463 1.0373323 0.9833662 0.9304156 0.8785473 0.8278273 0.7783207 0.7300920 0.6832049 0.6377227 0.5937079 0.5512226 0.5103287 0.4710874 0.4335599 0.3978070 0.3638895 0.3318682 0.3018038 0.2737572 0.2477897 0.2239626 0.2023380 0.1829782 0.1659463 0.1513061 0.1391223 0.1294606 0.1223876 0.1179713 0.1162810 0.1173875 0.1213631 0.1282379 0.1377814 0.1496675 0.1635700 0.1791624 0.1961176 0.2141070 0.2328012 0.2518687 0.2709767 0.2897905 0.3079738 0.3251886 0.3410956 0.3553543 0.3676234 0.3775613 0.3848263 0.3890777 0.3899759 0.3871832 0.3803650 0.3691903 0.3533326 0.3324714 0.3062925 0.2744898 0.2367665 0.1928358 0.1424229 0.0852699 0.0213537 -0.0490028 -0.1254440 -0.2076116 -0.2951454 -0.3876847 -0.4848695 -0.5863412 -0.6917440 -0.8007258 -0.9129388 -1.0280404 -1.1456943 -1.265571 -1.387347 -1.510709 -1.635350 -1.760974 -1.887291 -2.014024 -2.140903 -2.267671 -2.394077 -2.519884 -2.644862 -2.768795 -2.891473
Zmiz1 1.692460 1.620128 1.548284 1.4770258 1.4064517 1.3366561 1.2677317 1.1997693 1.1328575 1.0670831 1.0025311 0.9392846 0.8774250 0.8170324 0.7581850 0.7009598 0.6454326 0.5916778 0.5397690 0.4897787 0.4417787 0.3958401 0.3520335 0.3104293 0.2710975 0.2341082 0.1995316 0.1674381 0.1378988 0.1109854 0.0867703 0.0653274 0.0467314 0.0310587 0.0183876 0.0087980 0.0023723 -0.0008049 -0.0006463 0.0029386 0.0100432 0.0207646 0.0351502 0.0529327 0.0737289 0.0971551 0.1228261 0.1503547 0.1793509 0.2094211 0.2401680 0.2711898 0.3020808 0.3324305 0.3618246 0.3898446 0.4160685 0.4400715 0.4614265 0.4797050 0.4944783 0.5053183 0.5117993 0.5134992 0.5100009 0.5008944 0.4857787 0.4642634 0.4359712 0.4005401 0.3576257 0.3069037 0.2480769 0.1811419 0.1065214 0.0246817 -0.0639050 -0.1587625 -0.2594134 -0.3653805 -0.4761893 -0.5913699 -0.7104583 -0.8329983 -0.9585432 -1.0866568 -1.216915 -1.348906 -1.482232 -1.616511 -1.751375 -1.886472 -2.021469 -2.156045 -2.289901 -2.422751 -2.554328 -2.684380 -2.812675 -2.938994
Sox8 1.541021 1.472372 1.404425 1.3372801 1.2710316 1.2057720 1.1415897 1.0785697 1.0167939 0.9563410 0.8972867 0.8397039 0.7836630 0.7292316 0.6764755 0.6254579 0.5762404 0.5288829 0.4834439 0.4399806 0.3985491 0.3592051 0.3220035 0.2869992 0.2542470 0.2238021 0.1957205 0.1700588 0.1468751 0.1262289 0.1081817 0.0927970 0.0801412 0.0702833 0.0632959 0.0592551 0.0582413 0.0603393 0.0656390 0.0742358 0.0862311 0.1017327 0.1207991 0.1431576 0.1684119 0.1961630 0.2260070 0.2575338 0.2903259 0.3239571 0.3579922 0.3919862 0.4254844 0.4580226 0.4891280 0.5183194 0.5451092 0.5690045 0.5895093 0.6061268 0.6183617 0.6257239 0.6277310 0.6239125 0.6138136 0.5969993 0.5730590 0.5416113 0.5023089 0.4548433 0.3989504 0.3344155 0.2610836 0.1791532 0.0893108 -0.0077041 -0.1111443 -0.2202614 -0.3343119 -0.4525625 -0.5742961 -0.6988159 -0.8254499 -0.9535550 -1.0825199 -1.2117682 -1.340760 -1.468995 -1.596013 -1.721391 -1.844752 -1.965755 -2.084102 -2.199533 -2.311824 -2.420790 -2.526278 -2.628168 -2.726370 -2.820821
Tcf4 1.188263 1.164544 1.140864 1.1172416 1.0936946 1.0702412 1.0468995 1.0236873 1.0006227 0.9777234 0.9550072 0.9324920 0.9101952 0.8881346 0.8663276 0.8447917 0.8235445 0.8026031 0.7819850 0.7617073 0.7417874 0.7222424 0.7030893 0.6843453 0.6660275 0.6481527 0.6307380 0.6138004 0.5973566 0.5814237 0.5660184 0.5511576 0.5368582 0.5231369 0.5100106 0.4974962 0.4856103 0.4743700 0.4637920 0.4538932 0.4446905 0.4362008 0.4284214 0.4212326 0.4144716 0.4079761 0.4015836 0.3951321 0.3884596 0.3814043 0.3738047 0.3654995 0.3563278 0.3461287 0.3347421 0.3220082 0.3077678 0.2918625 0.2741345 0.2544272 0.2325847 0.2084528 0.1818784 0.1527100 0.1207979 0.0859946 0.0481545 0.0071349 -0.0372045 -0.0850009 -0.1363878 -0.1914954 -0.2504476 -0.3132493 -0.3797277 -0.4496947 -0.5229614 -0.5993386 -0.6786371 -0.7606679 -0.8452423 -0.9321722 -1.0212704 -1.1123509 -1.2052288 -1.2997211 -1.395646 -1.492825 -1.591080 -1.690236 -1.790122 -1.890568 -1.991408 -2.092480 -2.193623 -2.294682 -2.395504 -2.495942 -2.595851 -2.695092
Emx2 1.388616 1.350363 1.312306 1.2744825 1.2369310 1.1996891 1.1627933 1.1262800 1.0901847 1.0545424 1.0193875 0.9847538 0.9506748 0.9171833 0.8843115 0.8520914 0.8205544 0.7897314 0.7596531 0.7303498 0.7018514 0.6741875 0.6473874 0.6214804 0.5964952 0.5724607 0.5494055 0.5273582 0.5063472 0.4864011 0.4675484 0.4498177 0.4332378 0.4178375 0.4036461 0.3906929 0.3790077 0.3686206 0.3595622 0.3518634 0.3455559 0.3406718 0.3372148 0.3350157 0.3338426 0.3334637 0.3336478 0.3341639 0.3347806 0.3352670 0.3353917 0.3349235 0.3336313 0.3312846 0.3276532 0.3225081 0.3156215 0.3067677 0.2957233 0.2822676 0.2661841 0.2472602 0.2252888 0.2000685 0.1714050 0.1391118 0.1030112 0.0629352 0.0187268 -0.0297589 -0.0826539 -0.1400758 -0.2021244 -0.2687321 -0.3395926 -0.4143788 -0.4927640 -0.5744236 -0.6590361 -0.7462841 -0.8358563 -0.9274474 -1.0207603 -1.1155057 -1.2114040 -1.3081851 -1.405590 -1.503369 -1.601286 -1.699115 -1.796643 -1.893667 -1.989999 -2.085460 -2.179886 -2.273123 -2.365029 -2.455474 -2.544338 -2.631514
Etv4 1.063184 1.036765 1.010452 0.9842823 0.9582902 0.9325114 0.9069807 0.8817326 0.8568014 0.8322209 0.8080244 0.7842452 0.7609161 0.7380697 0.7157382 0.6939535 0.6727475 0.6521517 0.6321974 0.6129157 0.5943376 0.5764939 0.5594155 0.5431329 0.5276767 0.5130775 0.4993659 0.4865725 0.4747280 0.4638631 0.4540088 0.4451962 0.4374566 0.4308216 0.4253231 0.4209932 0.4178645 0.4159701 0.4153434 0.4160184 0.4180297 0.4214123 0.4261700 0.4321144 0.4389864 0.4465265 0.4544743 0.4625686 0.4705474 0.4781478 0.4851058 0.4911570 0.4960363 0.4994786 0.5012190 0.5009930 0.4985377 0.4935917 0.4858962 0.4751955 0.4612382 0.4437776 0.4225732 0.3973911 0.3680058 0.3342007 0.2957701 0.2525194 0.2042676 0.1508476 0.0921085 0.0279162 -0.0418413 -0.1170799 -0.1974353 -0.2825177 -0.3719369 -0.4653039 -0.5622324 -0.6623405 -0.7652522 -0.8705985 -0.9780191 -1.0871631 -1.1976903 -1.3092719 -1.421592 -1.534346 -1.647247 -1.760017 -1.872396 -1.984139 -2.095015 -2.204807 -2.313315 -2.420354 -2.525752 -2.629354 -2.731016 -2.830610
Foxn3 1.179599 1.141323 1.103284 1.0655356 1.0281353 0.9911373 0.9545949 0.9185608 0.8830866 0.8482227 0.8140190 0.7805244 0.7477868 0.7158537 0.6847715 0.6545863 0.6253433 0.5970874 0.5698628 0.5437135 0.5186830 0.4948147 0.4721516 0.4507368 0.4306132 0.4118238 0.3944119 0.3784208 0.3638943 0.3508766 0.3394123 0.3295468 0.3213263 0.3147976 0.3100086 0.3070086 0.3058476 0.3065773 0.3092509 0.3139231 0.3206504 0.3294913 0.3404647 0.3533427 0.3678057 0.3835323 0.4001992 0.4174805 0.4350473 0.4525676 0.4697061 0.4861248 0.5014824 0.5154354 0.5276386 0.5377454 0.5454093 0.5502843 0.5520266 0.5502957 0.5447560 0.5350785 0.5209422 0.5020367 0.4780635 0.4487388 0.4137952 0.3729845 0.3260798 0.2728779 0.2132021 0.1469041 0.0738710 -0.0057573 -0.0914859 -0.1827868 -0.2791311 -0.3799923 -0.4848492 -0.5931892 -0.7045105 -0.8183246 -0.9341584 -1.0515564 -1.1700820 -1.2893189 -1.408872 -1.528370 -1.647463 -1.765825 -1.883155 -1.999173 -2.113626 -2.226282 -2.336933 -2.445392 -2.551495 -2.655096 -2.756072 -2.854316
Zfp281 2.378367 2.270968 2.164729 2.0597633 1.9561796 1.8540826 1.7535721 1.6547438 1.5576888 1.4624948 1.3692450 1.2780194 1.1888944 1.1019430 1.0172356 0.9348392 0.8548186 0.7772360 0.7021517 0.6296238 0.5597091 0.4924626 0.4279386 0.3661900 0.3072695 0.2512294 0.1981216 0.1479987 0.1009133 0.0569192 0.0160710 -0.0215750 -0.0559612 -0.0870275 -0.1147117 -0.1389488 -0.1596707 -0.1768060 -0.1902791 -0.2000107 -0.2059162 -0.2079065 -0.2059358 -0.2002459 -0.1911817 -0.1790854 -0.1642976 -0.1471587 -0.1280096 -0.1071931 -0.0850543 -0.0619415 -0.0382067 -0.0142057 0.0097015 0.0331506 0.0557733 0.0771978 0.0970487 0.1149479 0.1305155 0.1433708 0.1531329 0.1594227 0.1618639 0.1600845 0.1537191 0.1424102 0.1258110 0.1035865 0.0754170 0.0409995 0.0000550 -0.0474449 -0.1011638 -0.1607271 -0.2257548 -0.2958626 -0.3706648 -0.4497757 -0.5328118 -0.6193930 -0.7091449 -0.8016993 -0.8966964 -0.9937853 -1.092625 -1.192887 -1.294252 -1.396416 -1.499085 -1.601981 -1.704839 -1.807406 -1.909446 -2.010734 -2.111059 -2.210227 -2.308052 -2.404366
Thap2 2.355146 2.240364 2.127227 2.0158548 1.9063593 1.7988465 1.6934154 1.5901587 1.4891629 1.3905090 1.2942724 1.2005237 1.1093286 1.0207485 0.9348408 0.8516593 0.7712547 0.6936744 0.6189638 0.5471658 0.4783216 0.4124712 0.3496534 0.2899066 0.2332688 0.1797783 0.1294740 0.0823957 0.0385847 -0.0019159 -0.0390609 -0.0728020 -0.1030883 -0.1298648 -0.1530728 -0.1726486 -0.1885238 -0.2006239 -0.2088686 -0.2131705 -0.2134347 -0.2095581 -0.2014833 -0.1894673 -0.1738806 -0.1550911 -0.1334661 -0.1093741 -0.0831869 -0.0552805 -0.0260369 0.0041555 0.0349004 0.0657941 0.0964242 0.1263707 0.1552054 0.1824932 0.2077927 0.2306574 0.2506374 0.2672809 0.2801367 0.2887565 0.2926974 0.2915251 0.2848172 0.2721667 0.2531855 0.2275086 0.1947980 0.1547466 0.1070875 0.0518572 -0.0104773 -0.0794007 -0.1543888 -0.2349124 -0.3204412 -0.4104481 -0.5044119 -0.6018212 -0.7021766 -0.8049936 -0.9098047 -1.0161612 -1.123635 -1.231819 -1.340329 -1.448806 -1.556911 -1.664333 -1.770781 -1.875992 -1.979723 -2.081755 -2.181891 -2.279955 -2.375792 -2.469266
Etv5 2.670575 2.537633 2.406735 2.2780114 2.1515866 2.0275743 1.9060801 1.7872017 1.6710292 1.5576448 1.4471241 1.3395358 1.2349424 1.1334005 1.0349614 0.9396712 0.8475717 0.7587005 0.6730915 0.5907756 0.5117808 0.4361332 0.3638567 0.2949744 0.2295082 0.1674801 0.1089119 0.0538264 0.0022472 -0.0458000 -0.0902877 -0.1311854 -0.1684598 -0.2020734 -0.2319847 -0.2581472 -0.2805091 -0.2990122 -0.3135921 -0.3241766 -0.3306858 -0.3330307 -0.3311630 -0.3253228 -0.3158517 -0.3030863 -0.2873597 -0.2690041 -0.2483523 -0.2257394 -0.2015044 -0.1759908 -0.1495482 -0.1225325 -0.0953067 -0.0682408 -0.0417123 -0.0161053 0.0081894 0.0307755 0.0512522 0.0692152 0.0842586 0.0959768 0.1039662 0.1078280 0.1071706 0.1016125 0.0907855 0.0743380 0.0519382 0.0232782 -0.0119183 -0.0536628 -0.1015864 -0.1552767 -0.2143118 -0.2782633 -0.3466996 -0.4191885 -0.4953005 -0.5746108 -0.6567021 -0.7411665 -0.8276076 -0.9156420 -1.004901 -1.095033 -1.185700 -1.276586 -1.367392 -1.457836 -1.547657 -1.636615 -1.724486 -1.811066 -1.896172 -1.979636 -2.061309 -2.141059
Pias4 2.438095 2.339052 2.240891 2.1437030 2.0475745 1.9525903 1.8588322 1.7663788 1.6753061 1.5856872 1.4975928 1.4110911 1.3262478 1.2431264 1.1617881 1.0822921 1.0046958 0.9290546 0.8554223 0.7838513 0.7143924 0.6470953 0.5820085 0.5191796 0.4586554 0.4004821 0.3447053 0.2913704 0.2405226 0.1922072 0.1464695 0.1033555 0.0629115 0.0251847 -0.0097768 -0.0419238 -0.0712057 -0.0975704 -0.1209639 -0.1413304 -0.1586117 -0.1727472 -0.1837101 -0.1916863 -0.1969373 -0.1997219 -0.2002963 -0.1989147 -0.1958304 -0.1912957 -0.1855628 -0.1788840 -0.1715118 -0.1636996 -0.1557014 -0.1477720 -0.1401673 -0.1331438 -0.1269588 -0.1218702 -0.1181360 -0.1160139 -0.1157616 -0.1176352 -0.1218896 -0.1287774 -0.1385483 -0.1514484 -0.1677192 -0.1875969 -0.2113114 -0.2390853 -0.2711300 -0.3074919 -0.3479733 -0.3923534 -0.4404095 -0.4919173 -0.5466523 -0.6043899 -0.6649065 -0.7279799 -0.7933903 -0.8609202 -0.9303555 -1.0014859 -1.074105 -1.148011 -1.223007 -1.298900 -1.375505 -1.452640 -1.530131 -1.607807 -1.685505 -1.763069 -1.840347 -1.917194 -1.993472 -2.069046
Etv1 2.620729 2.496198 2.373705 2.2533622 2.1352699 2.0195224 1.9062057 1.7953982 1.6871710 1.5815884 1.4787079 1.3785811 1.2812533 1.1867649 1.0951506 1.0064410 0.9206622 0.8378364 0.7579825 0.6811163 0.6072511 0.5363980 0.4685665 0.4037645 0.3419993 0.2832775 0.2276057 0.1749910 0.1254411 0.0789650 0.0355733 -0.0047214 -0.0419040 -0.0759563 -0.1068571 -0.1345809 -0.1590984 -0.1803753 -0.1983718 -0.2130427 -0.2243362 -0.2321937 -0.2365906 -0.2377420 -0.2359461 -0.2314952 -0.2246776 -0.2157790 -0.2050843 -0.1928790 -0.1794500 -0.1650868 -0.1500821 -0.1347325 -0.1193386 -0.1042052 -0.0896414 -0.0759600 -0.0634772 -0.0525119 -0.0433845 -0.0364160 -0.0319263 -0.0302328 -0.0316487 -0.0364806 -0.0450264 -0.0575732 -0.0743940 -0.0957459 -0.1218663 -0.1529707 -0.1892458 -0.2306636 -0.2768914 -0.3275637 -0.3823090 -0.4407531 -0.5025216 -0.5672427 -0.6345493 -0.7040812 -0.7754872 -0.8484270 -0.9225722 -0.9976085 -1.073236 -1.149171 -1.225145 -1.300909 -1.376228 -1.450888 -1.524690 -1.597453 -1.669015 -1.739227 -1.807961 -1.875100 -1.940546 -2.004212
Sall3 2.500433 2.389266 2.279301 2.1706518 2.0634286 1.9577361 1.8536742 1.7513385 1.6508199 1.5522049 1.4555761 1.3610116 1.2685858 1.1783694 1.0904296 1.0048302 0.9216320 0.8408927 0.7626676 0.6870095 0.6139689 0.5435947 0.4759339 0.4110323 0.3489344 0.2896842 0.2333249 0.1798997 0.1294517 0.0820247 0.0376628 -0.0035884 -0.0416824 -0.0765706 -0.1082024 -0.1365249 -0.1614825 -0.1830160 -0.2010631 -0.2155573 -0.2264277 -0.2335987 -0.2370338 -0.2369554 -0.2336781 -0.2275122 -0.2187658 -0.2077453 -0.1947565 -0.1801061 -0.1641016 -0.1470529 -0.1292720 -0.1110740 -0.0927769 -0.0747019 -0.0571734 -0.0405188 -0.0250681 -0.0111534 0.0008916 0.0107322 0.0180340 0.0224635 0.0236898 0.0213853 0.0152278 0.0049014 -0.0099010 -0.0294764 -0.0541096 -0.0840711 -0.1196112 -0.1607620 -0.2072375 -0.2587186 -0.3148811 -0.3753973 -0.4399372 -0.5081708 -0.5797692 -0.6544059 -0.7317584 -0.8115093 -0.8933473 -0.9769685 -1.062077 -1.148386 -1.235620 -1.323510 -1.411801 -1.500250 -1.588623 -1.676701 -1.764274 -1.851147 -1.937135 -2.022066 -2.105781 -2.188132
Zfp422 1.693086 1.661176 1.629326 1.5975225 1.5657528 1.5340037 1.5022623 1.4705157 1.4387514 1.4069568 1.3751196 1.3432274 1.3112681 1.2792297 1.2471003 1.2148682 1.1825217 1.1500494 1.1174398 1.0846819 1.0517646 1.0186768 0.9854079 0.9519472 0.9182842 0.8844087 0.8503104 0.8159793 0.7814056 0.7465795 0.7114917 0.6761326 0.6404932 0.6045645 0.5683376 0.5318039 0.4949549 0.4577825 0.4202785 0.3824350 0.3442446 0.3056996 0.2667986 0.2275747 0.1880730 0.1483382 0.1084146 0.0683457 0.0281745 -0.0120565 -0.0523054 -0.0925310 -0.1326925 -0.1727500 -0.2126639 -0.2523953 -0.2919059 -0.3311579 -0.3701144 -0.4087387 -0.4469949 -0.4848475 -0.5222617 -0.5592031 -0.5956380 -0.6315330 -0.6668553 -0.7015727 -0.7356531 -0.7690652 -0.8017779 -0.8337606 -0.8649834 -0.8954397 -0.9251577 -0.9541682 -0.9825015 -1.0101875 -1.0372556 -1.0637349 -1.0896541 -1.1150416 -1.1399253 -1.1643329 -1.1882916 -1.2118285 -1.234970 -1.257743 -1.280174 -1.302288 -1.324110 -1.345667 -1.366983 -1.388083 -1.408991 -1.429733 -1.450331 -1.470811 -1.491194 -1.511507
Lef1 1.982573 1.930623 1.879136 1.8281018 1.7775128 1.7273596 1.6776339 1.6283274 1.5794319 1.5309395 1.4828427 1.4351340 1.3878059 1.3408515 1.2942639 1.2480362 1.2021620 1.1566348 1.1114485 1.0665971 1.0220746 0.9778754 0.9339939 0.8904248 0.8471628 0.8042029 0.7615402 0.7191700 0.6770875 0.6352884 0.5937684 0.5525232 0.5115488 0.4708413 0.4303970 0.3902122 0.3502835 0.3106074 0.2711806 0.2320002 0.1930630 0.1543661 0.1159097 0.0777097 0.0397876 0.0021637 -0.0351423 -0.0721118 -0.1087270 -0.1449708 -0.1808270 -0.2162803 -0.2513161 -0.2859205 -0.3200804 -0.3537834 -0.3870177 -0.4197723 -0.4520368 -0.4838013 -0.5150567 -0.5457942 -0.5760057 -0.6056837 -0.6348210 -0.6634110 -0.6914475 -0.7189245 -0.7458368 -0.7721793 -0.7979472 -0.8231361 -0.8477420 -0.8717721 -0.8952492 -0.9181971 -0.9406386 -0.9625959 -0.9840906 -1.0051435 -1.0257748 -1.0460043 -1.0658510 -1.0853335 -1.1044698 -1.1232775 -1.141773 -1.159974 -1.177896 -1.195555 -1.212965 -1.230142 -1.247101 -1.263855 -1.280417 -1.296802 -1.313022 -1.329089 -1.345017 -1.360817
write.table(heatmap_matrix_q_value_0.01, file = file.path(tables_directory, "4-forebrain_astro_ependymal_joint_cortex_cluster_20_2_12_23-significant_transcription_factors_diff_test_analysis_qval_0.01_heatmap_matrix.txt"), sep="\t", quote=FALSE, row.names=FALSE)
2.2.2.1.3 Plotting of transcription factors differentially expressed in pseudotime
2.2.2.1.3.1 Top 10 differentially expressed genes (q value < 5*10^-5)
transcription_factors_table_q_value_5_10_minus_5_ordered_qval <- arrange(transcription_factors_table_q_value_5_10_minus_5, qval)
marker <- transcription_factors_table_q_value_5_10_minus_5_ordered_qval$gene[1]
p1 <- plot_cell_trajectory(monocle, markers=marker)
p2 <- plot_cell_trajectory(monocle, use_color_gradient = TRUE, markers=marker)
show(p1+p2)

marker <- transcription_factors_table_q_value_5_10_minus_5_ordered_qval$gene[2]
p1 <- plot_cell_trajectory(monocle, markers=marker)
p2 <- plot_cell_trajectory(monocle, use_color_gradient = TRUE, markers=marker)
show(p1+p2)

marker <- transcription_factors_table_q_value_5_10_minus_5_ordered_qval$gene[3]
p1 <- plot_cell_trajectory(monocle, markers=marker)
p2 <- plot_cell_trajectory(monocle, use_color_gradient = TRUE, markers=marker)
show(p1+p2)

marker <- transcription_factors_table_q_value_5_10_minus_5_ordered_qval$gene[4]
p1 <- plot_cell_trajectory(monocle, markers=marker)
p2 <- plot_cell_trajectory(monocle, use_color_gradient = TRUE, markers=marker)
show(p1+p2)

marker <- transcription_factors_table_q_value_5_10_minus_5_ordered_qval$gene[5]
p1 <- plot_cell_trajectory(monocle, markers=marker)
p2 <- plot_cell_trajectory(monocle, use_color_gradient = TRUE, markers=marker)
show(p1+p2)

marker <- transcription_factors_table_q_value_5_10_minus_5_ordered_qval$gene[6]
p1 <- plot_cell_trajectory(monocle, markers=marker)
p2 <- plot_cell_trajectory(monocle, use_color_gradient = TRUE, markers=marker)
show(p1+p2)

marker <- transcription_factors_table_q_value_5_10_minus_5_ordered_qval$gene[7]
p1 <- plot_cell_trajectory(monocle, markers=marker)
p2 <- plot_cell_trajectory(monocle, use_color_gradient = TRUE, markers=marker)
show(p1+p2)

marker <- transcription_factors_table_q_value_5_10_minus_5_ordered_qval$gene[8]
p1 <- plot_cell_trajectory(monocle, markers=marker)
p2 <- plot_cell_trajectory(monocle, use_color_gradient = TRUE, markers=marker)
show(p1+p2)

marker <- transcription_factors_table_q_value_5_10_minus_5_ordered_qval$gene[9]
p1 <- plot_cell_trajectory(monocle, markers=marker)
p2 <- plot_cell_trajectory(monocle, use_color_gradient = TRUE, markers=marker)
show(p1+p2)

marker <- transcription_factors_table_q_value_5_10_minus_5_ordered_qval$gene[10]
p1 <- plot_cell_trajectory(monocle, markers=marker)
p2 <- plot_cell_trajectory(monocle, use_color_gradient = TRUE, markers=marker)
show(p1+p2)

2.3 Selected genes

# Genes of interest.
genes_of_interest <- c("Aqp4", "Fabp7", "Foxj1", "Nes", "Top2a", "Aldoc")

# Remove genes of interest not present in Seurat dataset
genes_not_present <- genes_of_interest[!genes_of_interest %in% rownames(seurat@data)]
genes_of_interest <- genes_of_interest[!genes_of_interest %in% genes_not_present]
if(length(genes_not_present != 0)) {
  print(paste0("The following genes were not present in the Seurat object", genes_not_present))
}
      
diff_test_res <- differentialGeneTest(monocle[genes_of_interest],
      fullModelFormulaStr = "~sm.ns(Pseudotime)")
sig_gene_names <- row.names(subset(diff_test_res, qval < 0.1))
plot_pseudotime_heatmap(monocle[genes_of_interest,],
      num_clusters = 1,
      cores = 1,
      show_rownames = T)

2.3.1 Genes in pseudotime, single branch (Selected genes)

p <- plot_genes_in_pseudotime(monocle[genes_of_interest,], color_by="cluster") + scale_color_manual(values=colours)
p <- p %>% remove_geom("point")
p <- p %>% remove_geom("Line")
p <- p %>% + geom_line(aes(x = Pseudotime, y = expectation), size=1)
show(p)

2.3.2 Genes in pseudotime with branches (Selected genes)

p <- plot_genes_branched_pseudotime(monocle[genes_of_interest,], color_by="cluster") + scale_color_manual(values=colours)
show(p)

p <- p %>% remove_geom("point")
show(p)

3 Seurat tSNE plots

p <- cytokit::tsne(seurat, label=FALSE)
show(p)

p <- tsne_plot_clusters_highlighted(seurat, selected_clusters, legend=TRUE)
show(p)

p <- p + theme(legend.position = "none")
show(p)

p <- tsne_plot_clusters_highlighted_with_pseudotime(seurat, monocle, selected_clusters, legend=TRUE)
show(p)

p <- p + theme(legend.position = "none")
show(p)

4 Save monocle object to directory, and write pseudotime of cells to table.

save(monocle, file=file.path(monocle_objects_directory, "4-forebrain_astro_ependymal_joint_cortex_cluster_20_2_12_23.Rda"))
cells_pseudotime <- pData(monocle) %>% select(cell, Pseudotime) %>% rename(pseudotime=Pseudotime)
write.table(cells_pseudotime, file.path(tables_directory, "4-forebrain_astro_ependymal_joint_cortex_cluster_20_2_12_23_cell_pseudotime.txt"), sep="\t", quote=FALSE, row.names=FALSE)

5 Session info

sessionInfo()
## R version 3.5.0 (2018-04-23)
## Platform: x86_64-redhat-linux-gnu (64-bit)
## Running under: CentOS Linux 7 (Core)
## 
## Matrix products: default
## BLAS/LAPACK: /var/chroots/hydraex-centos-7/usr/lib64/R/lib/libRblas.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
##  [1] splines   stats4    parallel  stats     graphics  grDevices utils    
##  [8] datasets  methods   base     
## 
## other attached packages:
##  [1] viridis_0.5.1       viridisLite_0.3.0   forcats_0.4.0      
##  [4] stringr_1.4.0       dplyr_0.8.0.1       purrr_0.3.0        
##  [7] tidyr_0.8.2         tibble_2.0.1        tidyverse_1.2.1    
## [10] Seurat_2.3.4        cowplot_0.9.4       R.utils_2.8.0      
## [13] R.oo_1.22.0         R.methodsS3_1.7.1   readr_1.3.1        
## [16] readxl_1.3.0        patchwork_0.0.1     monocle_2.10.1     
## [19] DDRTree_0.1.5       irlba_2.3.3         VGAM_1.1-1         
## [22] Biobase_2.42.0      BiocGenerics_0.28.0 Matrix_1.2-15      
## [25] kableExtra_1.0.1    ggedit_0.3.0        ggplot2_3.1.0      
## [28] cytokit_0.6.0       pheatmap_1.0.12     colorRamps_2.3     
## 
## loaded via a namespace (and not attached):
##   [1] snow_0.4-3           backports_1.1.3      Hmisc_4.2-0         
##   [4] plyr_1.8.4           igraph_1.2.4         lazyeval_0.2.1      
##   [7] densityClust_0.3     fastICA_1.2-1        digest_0.6.18       
##  [10] foreach_1.4.4        htmltools_0.3.6      lars_1.2            
##  [13] gdata_2.18.0         magrittr_1.5         checkmate_1.9.1     
##  [16] cluster_2.0.7-1      mixtools_1.1.0       ROCR_1.0-7          
##  [19] limma_3.38.3         modelr_0.1.3         matrixStats_0.54.0  
##  [22] docopt_0.6.1         colorspace_1.4-0     ggrepel_0.8.0       
##  [25] rvest_0.3.2          haven_2.0.0          xfun_0.4            
##  [28] sparsesvd_0.1-4      crayon_1.3.4         jsonlite_1.6        
##  [31] survival_2.43-3      zoo_1.8-4            iterators_1.0.10    
##  [34] ape_5.2              glue_1.3.0           gtable_0.2.0        
##  [37] webshot_0.5.1        kernlab_0.9-27       prabclus_2.2-7      
##  [40] DEoptimR_1.0-8       scales_1.0.0         mvtnorm_1.0-8       
##  [43] bibtex_0.4.2         miniUI_0.1.1.1       Rcpp_1.0.0          
##  [46] metap_1.1            dtw_1.20-1           xtable_1.8-3        
##  [49] htmlTable_1.13.1     reticulate_1.11.1    foreign_0.8-71      
##  [52] bit_1.1-14           proxy_0.4-22         mclust_5.4.2        
##  [55] SDMTools_1.1-221     Formula_1.2-3        tsne_0.1-3          
##  [58] htmlwidgets_1.3      httr_1.4.0           FNN_1.1.3           
##  [61] gplots_3.0.1.1       RColorBrewer_1.1-2   shinyAce_0.3.3      
##  [64] fpc_2.1-11.1         acepack_1.4.1        modeltools_0.2-22   
##  [67] ica_1.0-2            pkgconfig_2.0.2      flexmix_2.3-14      
##  [70] nnet_7.3-12          labeling_0.3         tidyselect_0.2.5    
##  [73] rlang_0.3.1          reshape2_1.4.3       later_0.8.0         
##  [76] cellranger_1.1.0     munsell_0.5.0        tools_3.5.0         
##  [79] cli_1.0.1            generics_0.0.2       broom_0.5.1         
##  [82] ggridges_0.5.1       evaluate_0.13        shinyBS_0.61        
##  [85] yaml_2.2.0           npsurv_0.4-0         knitr_1.21          
##  [88] bit64_0.9-7          fitdistrplus_1.0-14  robustbase_0.93-3   
##  [91] caTools_1.17.1.1     randomForest_4.6-14  RANN_2.6.1          
##  [94] pbapply_1.4-0        nlme_3.1-137         mime_0.6            
##  [97] slam_0.1-44          xml2_1.2.0           hdf5r_1.0.0         
## [100] compiler_3.5.0       rstudioapi_0.9.0     png_0.1-7           
## [103] lsei_1.2-0           stringi_1.3.1        highr_0.7           
## [106] lattice_0.20-35      trimcluster_0.1-2.1  HSMMSingleCell_1.2.0
## [109] pillar_1.3.1         combinat_0.0-8       Rdpack_0.10-1       
## [112] lmtest_0.9-36        data.table_1.12.0    bitops_1.0-6        
## [115] gbRd_0.4-11          httpuv_1.4.5.1       R6_2.4.0            
## [118] latticeExtra_0.6-28  promises_1.0.1       KernSmooth_2.23-15  
## [121] gridExtra_2.3        codetools_0.2-15     MASS_7.3-51.1       
## [124] gtools_3.8.1         assertthat_0.2.0     withr_2.1.2         
## [127] qlcMatrix_0.9.7      diptest_0.75-7       doSNOW_1.0.16       
## [130] hms_0.4.2            grid_3.5.0           rpart_4.1-13        
## [133] class_7.3-14         rmarkdown_1.11       segmented_0.5-3.0   
## [136] Rtsne_0.15           lubridate_1.7.4      shiny_1.2.0         
## [139] base64enc_0.1-3